package com.Jano.controller;

import com.Jano.annotation.LogAnnotation;
import com.Jano.annotation.Permission;
import com.Jano.entity.Invitation;
import com.Jano.service.InvitationService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * description: InvitationController <br>
 * date: 2022/7/12 8:29 PM <br>
 * author: zoumaoji <br>
 * version: 1.0 <br>
 */

@RestController
@RequestMapping("/invitations")
public class InvitationController {
    @Autowired
    InvitationService invitationService;

    @Permission("/invitations/page.action")
    @LogAnnotation(title ="论帖模块",action ="论帖分页信息")
    @RequestMapping("/page.action")
    public PageInfo<Invitation> getInvitationPagination(Integer pageNum, Integer pageSize) {
        return invitationService.findInvitationPagination(pageNum, pageSize);
    }

    @Permission("/invitations/query.action")
    @LogAnnotation(title ="论帖模块",action ="查询论帖信息")
    @RequestMapping("/query.action")
    public PageInfo<Invitation> queryInvitationByName(Integer pageNum, Integer pageSize, String title) {
        return invitationService.findInvitationByName( pageNum, pageSize, title);
    }

    @Permission("/invitations/modify.action")
    @LogAnnotation(title = "论帖模块",action ="删除论帖信息")
    @RequestMapping("/modify.action")
    public Boolean modifyInvitationById(Integer InvitationId) {
        return invitationService.deleteInvitationById(InvitationId);
    }

}
